package com.heiye.auth.controller;

import com.heiye.auth.model.vo.verificationcode.SendEmailVerificationCodeReqVO;
import com.heiye.auth.model.vo.verificationcode.SendPhoneVerificationCodeReqVO;
import com.heiye.auth.service.VerifyCodeService;
import com.heiye.framework.common.response.Response;
import com.heiye.framework.biz.operationlog.aspect.ApiOperationLog;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: heiye
 * @CreateTime: 2024/09/14 上午9:14
 * @Description: 验证码接口
 * @Version: 1.0
 */
@RestController
public class VerifyCodeController {

    @Resource
    private VerifyCodeService verifyCodeService;

    /**
     * 手机号发送验证码
     *
     * @param sendPhoneVerificationCodeReqVO
     * @return
     */
    @PostMapping("/verify/code/send/phone")
    @ApiOperationLog(description = "发送手机短信验证码")
    public Response<?> sendPhoneVerificationCode(@RequestBody SendPhoneVerificationCodeReqVO sendPhoneVerificationCodeReqVO) {
        return verifyCodeService.sendPhoneVerificationCode(sendPhoneVerificationCodeReqVO);
    }

    /**
     * 发送邮件验证码
     *
     * @param sendEmailVerificationCodeReqVO
     * @return
     */
    @PostMapping("/verify/code/send/email")
    @ApiOperationLog(description = "发送邮件验证码")
    public Response<?> sendEmailVerificationCode(@RequestBody SendEmailVerificationCodeReqVO sendEmailVerificationCodeReqVO) {
        return verifyCodeService.sendEmailVerificationCode(sendEmailVerificationCodeReqVO);
    }
}
